<?php

namespace App\Http\Controllers\Api;

use App\Http\Controllers\Controller;
use App\Http\Controllers\HandleCurl2;
use App\Http\Controllers\HandleRedis;

class HomeController extends Controller
{
    public function index()
    {
        $aa = HandleRedis::getTableOpenTime();
        dd($aa);
//        $getWxUrl = \App\Http\Controllers\HandleCurl::getWxUrl();
//        foreach ($getWxUrl->diffDataByTableId() as $showhao=>$v) {
//            list($status,$other,$shoeGameResult,$fengpan) = array_values($v);//获取对应的数据
//            if($status['showhao'] == 13) {
//                self::test($status,$other,$shoeGameResult,$fengpan);
//            }
//        }
    }

    public function index1()
    {
        $allResult = HandleRedis::getAllResultData();
        dd($allResult);
    }

//    $status;//2根据这个状态处理开奖结果
//    $other;//5   $bffilebuf (处理路单的)
//    $shoeGameResult;//8  $bffilebufb
//    $fengpan;//11
    private function test($status,$other,$shoeGameResult,$fengpan)
    {
        dump(compact('status','other','shoeGameResult','fengpan'));
        $allBet = HandleRedis::getAllUserBet($status['showhao']);
        $allChat = HandleRedis::getAllChat($status['showhao']);

        foreach ($allBet as $userBet) {//用户的下注信息
            if($userBet['type'] == 'robot') continue;
            dump($userBet);
            $beta = matchFocusContent($userBet['content']);//分割投注信息内容
            foreach ([$beta] as $bet) { //假设有多个注
                $uid = $userBet['id'];//用户id
                $cid = 0;//原代码为0 (详细信息表 不知道用来干嘛)
                $showhao = $userBet['showhao'];//台子id
                $ju = $other['shoeNo'] . '/' . $other['gameNo'];//局数\靴
                $money = getChineseBySingleLetter($bet['message']) . " {$bet['money']}<br>";//投注信息格式
                $money_all = $bet['money'];//存储用户下注的所有金额
                $money_cai = (self::$AllPerCent[$bet['message']] * $bet['money']) + $bet['money'];//根据闲对..计算总金额*赔率 = 总派彩(money_cai)
//                if()
                $data['sf'] = '';//总派彩-总下注=胜负(sf)
                $data['time'] = $userBet['time'];//下注时间
                $data['room'] = self::$AllRoomIdByShowhao[$userBet['showhao']];//房间id
                $data['all_z'] = '';
                $data['all_x'] = '';
                $data['all_h'] = '';
                $data['all_zd'] = '';
                $data['all_xd'] = '';
                $data['all_shui'] = '';
                $data['all_zx_xima'] = '';
                $data['all_zx_xima_wx'] = '';
                $data['all_sb_xima'] = '';
                $data['result'] = '___'.getChineseBySingleLetter($bet['message']);
                $data['all_sb_sy'] = '';
                $data['dec_money'] = '';
            }




            die;
        }


    }
}
